var app = getApp();
Page({
  data: {
    footer: {
      i_home: "../images/button1on.png",
      i_tel: "../images/button2.png",
      i_chat: "../images/button4.png",
      i_add: "../images/button5.png",
    },
    baseinfo: [],
    swipers: null,
  },
  onShareAppMessage: function () {
    return {
      title: app.globalData.shopName,
      path: '/pages/index/index?fromInviteCode=' + app.globalData.myInviteCode,
      success: function (res) {
        //console.log("转发成功");
      }
    }
  },
  onLoad: function (options) {
    app.appstart();
    var that = this;
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          scrollHeight: res.windowHeight
        });
      }
    });
    
  },
  gotoproductlist: function (e) {
    var cateId = e.currentTarget.dataset.id;
    //console.log("cateId=" + cateId);
    wx.navigateTo({
      url: 'productlist?cateId=' + cateId
    })
  },

  //页面加载的时候进行初始化数据
  onReady: function () {
    //初始化数据运行的函数
    this.getBase();
    this.getadphoto();
    this.getProducts();
  },

  //获得广告照片的图片以及首页需要展示的数据
  getadphoto: function () {
    var that = this;
    app.util.request({
      'url': 'entry/wxapp/getlist',
      'cachetime': '30',
      success: function (res) {
        var swipers = res.data.data.adv;
        var goods_list = res.data.data.rlist;
        var cate_gory = res.data.data.is_showcategory;
        that.setData({
          swipers: swipers,
          cate_gory: cate_gory,
          arraydetail: goods_list,
        })
      }
    })
  },




  getBase: function () {
    var that = this;
    app.util.request({
      'url': 'entry/wxapp/base',
      'cachetime': '30',
      success: function (res) {
        that.setData({
          baseinfo: res.data.data,
        })
      }
    })
  },
  getProducts: function () {
    var that = this;
    app.util.request({
      'url': 'entry/wxapp/base',
      'cachetime': '30',
      success: function (res) {
        that.setData({
          baseinfo: res.data.data,
        })
      }
    })
  },












})